{extend name="layout/iframe" /}

{block name="pagecss"}
<style>
    .layui-form-label {
        width: 160px;
    }
    .layui-input-block {
        margin-left: 200px;
    }
</style>
{/block}

{block name="content"}
<div class="layui-card-body layui-layout-admin" style="padding: 15px;">
    <form class="layui-form" action="" lay-filter="component-form-group">

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><span class="required">*</span>收银机SN</label>
            <div class="layui-input-block">
                <input type="text" class="layui-input" name="serial_number" lay-verify="serial_number" placeholder="" autocomplete="off">
            </div>
        </div>

        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label"><span class="required">*</span>选择门店</label>
            <div class="layui-input-block">
                <select name="store_id" lay-verify="store_id">
                    <option value="">请选择</option>
                    {foreach name="store" item="vo"}
                    <option value="{$vo.id}">{$vo.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>

        <input type="hidden" name="id" value="">

        <div class="layui-form-item layui-row layui-col-xs12">
            <div class="layui-input-block">
                <div class="layui-footer">
                    <button type="button" class="layui-btn layui-btn-primary close-btn">取消</button>
                    <button type="button" class="layui-btn" lay-submit="" lay-filter="laySave">保存 <i class="layui-icon">&#xe609;</i></button>
                </div>
            </div>
        </div>
    </form>
</div>

<input type="hidden" class="save_url" value="{:url('admin/'.strtolower($model).'/savepost')}">
<input type="hidden" class="check_account_number_url" value="{:url('admin/'.strtolower($model).'/checkAccountNumber')}">
{/block}

{block name="pagescript"}
<script src="__STATIC__/admin/pages/js/storecashier.js" type="text/javascript"></script>
<script>
    layui.use(['layer', 'laydate'], function(){
        var $ = layui.jquery,
            laydate = layui.laydate;
        // 执行一个laydate实例
        var startDate = laydate.render({
            elem: '.start_date', //指定元素
            type: 'date',
            format: 'yyyy-MM-dd',
            trigger: 'click',
            done: function(value, date){
                //endDate.config.min.year = date.year;
                //endDate.config.min.date = date.date;

                endDate.config.min.year = date.year;
                endDate.config.min.month = date.month - 1;
                var day = date.date;
                if(date.hours == 23 && date.minutes == 59 && date.seconds == 59){
                    day = day + 1;
                }else{
                    endDate.config.min.hours = date.hours;
                    endDate.config.min.minutes = date.minutes;
                    endDate.config.min.seconds = date.seconds;
                }
                endDate.config.min.date = day;
            }
        });

        var endDate = laydate.render({
            elem: '.end_date',
            type: 'date',
            format: 'yyyy-MM-dd',
            trigger: 'click',
            done: function(value, date){
                //startDate.config.max.year = date.year;
                //startDate.config.max.date = date.date;

                startDate.config.max.year = date.year;
                startDate.config.max.month = date.month - 1;
                var day = date.date;
                if(date.hours == 0 && date.minutes == 0 && date.seconds == 0){
                    day = day - 1;
                }else{
                    startDate.config.max.hours = date.hours;
                    startDate.config.max.minutes = date.minutes;
                    startDate.config.max.seconds = date.seconds;
                }
                startDate.config.max.date = day;
            }
        });

        var layDate = laydate.render({
            elem: '.lay_date',
            type: 'date',
            format: 'yyyy-MM-dd',
            trigger: 'click',
            done: function(value, date){
                //
            }
        });
    });
</script>
{/block}